<template>
  <div class="score-page">
    <!-- 顶部导航栏 -->
    <van-nav-bar 
      title="前端框架应用项目开发" 
      left-arrow
      fixed
      placeholder
      @click-left="$router.back()"
    />

    <!-- 学生信息 -->
    <div class="student-info">
      <h3 class="student-name">测试学生</h3>
      <div class="student-details">
        <span class="student-id">0000000</span>
        <span class="student-class">27软件技术1班</span>
      </div>
    </div>

    <!-- 分数统计 -->
    <div class="score-summary">
      <div class="score-item">
        <span class="score-label">任务分:</span>
        <span class="score-value">60分</span>
      </div>
      <div class="score-item">
        <span class="score-label">加分:</span>
        <span class="score-value">10分</span>
      </div>
      <div class="score-item">
        <span class="score-label">课程分:</span>
        <span class="score-value">10分</span>
      </div>
      <div class="score-item">
        <span class="score-label">总评:</span>
        <span class="score-value">80分</span>
      </div>
    </div>

    <!-- 分割线 -->
    <van-divider class="section-divider">2.5</van-divider>

    <!-- 任务列表 -->
    <div class="task-table">
      <!-- 表头 -->
      <div class="table-header">
        <div class="header-task">任务</div>
        <div class="header-weight">权重占比(%)</div>
        <div class="header-deadline">截止时间</div>
        <div class="header-self-rate">自评率</div>
        <div class="header-self-score">自评</div>
        <div class="header-comment">评语</div>
      </div>

      <!-- 表格内容 -->
      <div class="table-body">
        <div 
          v-for="(task, index) in tasks" 
          :key="index"
          class="table-row"
        >
          <div class="cell-task">{{ task.name }}</div>
          <div class="cell-weight">{{ task.weight }}</div>
          <div class="cell-deadline">{{ task.deadline }}</div>
          <div class="cell-self-rate">{{ task.selfRate }}</div>
          <div class="cell-self-score">{{ task.selfScore }}</div>
          <div class="cell-comment">{{ task.comment || '-' }}</div>
        </div>
      </div>
    </div>

    <!-- 分页信息 -->
    <div class="pagination-info">
      <span>共 {{ tasks.length }} 条</span>
      <span>20条/页</span>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';

// 任务数据
const tasks = ref([
  { name: 'Vue3开发功能', weight: '7.5', deadline: '2024/03/17 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: 'Vue3组件化开发', weight: '10.0', deadline: '2024/03/31 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: 'Vue前端基础测试', weight: '7.5', deadline: '2024/05/12 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: 'Vue3路由的使用', weight: '7.5', deadline: '2024/04/07 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: '电影界获取日', weight: '7.5', deadline: '2024/04/14 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: 'Vue自动化测试', weight: '4.5', deadline: '2024/04/16 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: '状态管理Pnias', weight: '10.5', deadline: '2024/04/22 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: '使用UI组件库', weight: '8.0', deadline: '2024/04/30 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: 'common-list开源组件', weight: '12.0', deadline: '2024/05/07 23:59:59', selfRate: '未评', selfScore: '未作答', comment: '' },
  { name: 'Vue综合项目', weight: '25.0', deadline: '2024/05/15 09:55:00', selfRate: '未评', selfScore: '未作答', comment: '' }
]);
</script>

<style scoped>
.score-page {
  padding: 12px;
  background-color: #fff;
  min-height: 100vh;
}

.student-info {
  text-align: center;
  margin: 16px 0;
}

.student-name {
  font-size: 18px;
  font-weight: normal;
  margin: 0;
  color: #323233;
}

.student-details {
  margin-top: 8px;
  color: #969799;
  font-size: 14px;
}

.student-details span {
  margin: 0 8px;
}

.score-summary {
  display: flex;
  justify-content: space-between;
  margin: 16px 0;
  padding: 0 12px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-label {
  font-size: 12px;
  color: #969799;
}

.score-value {
  font-size: 16px;
  font-weight: bold;
  margin-top: 4px;
  color: #323233;
}

.section-divider {
  margin: 16px 0;
  font-size: 14px;
  color: #323233;
  padding: 0 12px;
}

.task-table {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ebedf0;
}

.table-header {
  display: flex;
  background-color: #f7f8fa;
  padding: 10px 12px;
  font-size: 14px;
  color: #969799;
  border-bottom: 1px solid #ebedf0;
}

.table-header > div {
  flex: 1;
  text-align: left;
}

.header-task {
  flex: 2 !important;
}

.table-body {
  background-color: white;
}

.table-row {
  display: flex;
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid #f5f5f5;
  align-items: center;
}

.table-row > div {
  flex: 1;
  text-align: left;
}

.cell-task {
  flex: 2 !important;
}

.pagination-info {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding: 0 12px;
  font-size: 14px;
  color: #969799;
}
</style>